{% extends 'window.twig' %}
{% block body %}
    <div class="admin-main-container">
        <form action="task.add?act=insert" method="post" class="form-horizontal data-view data-validate" post-type="ajax">
            <div class="with-padding">
                <table style="width: 100%">
                    <tr>
                        <td style="width: 48%">
                            <div class="form-item">
                                <div class="item-label">咨询者电话
                                    <span class="check-tips"></span>
                                    <label class="error" for="phone"></label>
                                </div>
                                <div class="controls">
                                    <input type="text" class="text input-large form-control" name="phone" remote-type="post"
                                           data-rules="required remote minlength maxlength" minlength="11" maxlength="11" remote-url="task.exists"
                                           data-message-required="请输入咨询者电话" data-message-maxlength="请输入正确的电话号码"
                                           data-message-minlength="请输入正确的电话号码">
                                </div>
                            </div>
                        </td>
                        <td style="width: 4%"></td>
                        <td>

                            <div class="form-item">
                                <div class="item-label">咨询者名字 </div>
                                <div class="controls">
                                    <input type="text" class="text input-large form-control" name="contact_name" value="">
                                </div>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div class="form-item">
                                <div class="item-label">
                                    咨询者QQ
                                    <label class="error" for="qq"></label>
                                </div>
                                <div class="controls">
                                    <input type="text" class="text input-large form-control"
                                           data-message-number="请输入正确的QQ号码"
                                           data-rules="remote number"name="qq" remote-type="post" remote-url="task.exists?action=qq">
                                </div>
                            </div>
                        </td>
                        <td></td>
                        <td>
                            <div class="form-item">
                                <div class="item-label">咨询者年龄 </div>
                                <div class="controls">
                                    <select name="age" class="form-control" id="">
                                        <option value="未知">未知</option>
                                        <option value="14">14</option>
                                        <option value="15">15</option>
                                        <option value="16">16</option>
                                        <option value="17">17</option>
                                        <option value="18">18</option>
                                        <option value="19">19</option>
                                        <option value="20">20</option>
                                        <option value="21-25">21-25</option>
                                        <option value="25以上">25以上</option>
                                    </select>
                                </div>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div class="form-item">
                                <div class="item-label">咨询者学历 </div>
                                <div class="controls">
                                    <select name="education" class="form-control" id="">
                                        <option value="未知">未知</option>
                                        <option value="初中以下">初中以下</option>
                                        <option value="初中">初中</option>
                                        <option value="高中">高中</option>
                                        <option value="中专">中专</option>
                                        <option value="大专">大专</option>
                                        <option value="本科">本科</option>
                                        <option value="本科以上">本科以上</option>
                                    </select>
                                </div>
                            </div>
                        </td>
                        <td></td>
                        <td>
                            <div class="form-item">
                                <div class="item-label">咨询者状态 </div>
                                <div class="controls">
                                    <select name="contact_state" class="form-control" id="">
                                        <option value="未知">未知</option>
                                        <option value="在读">在读</option>
                                        <option value="在职">在职</option>
                                        <option value="应届">应届</option>
                                        <option value="辍学">辍学</option>
                                        <option value="待业">待业</option>
                                        <option value="找工作中">找工作中</option>
                                    </select>
                                </div>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div class="form-item">
                                <div class="item-label">搜索关键字 </div>
                                <div class="controls">
                                    <input type="text" class="text input-large form-control" name="search_key" value="">
                                </div>
                            </div>
                        </td>
                        <td></td>
                        <td>
                            <div class="form-item">
                                <div class="item-label">意向专业 </div>
                                <div class="controls">
                                    <input type="text" class="text input-large form-control" name="major" value="">
                                </div>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div class="form-item">
                                <div class="item-label">联系时间</div>
                                <div class="controls">
                                    <input type="text" class="text input-large form-control datetime"
                                           name="contact_time" value="" date-format="yyyy-MM-dd HH:mm" >
                                </div>
                            </div>
                        </td>
                        <td></td>
                        <td>
                            <div class="form-item">
                                <div class="item-label">
                                    任务等级
                                    <label id="task_level-error" class="error" for="task_level">.</label>
                                </div>
                                <div class="controls">
                                    <select name="task_level" data-rules="required" data-message-required="请选择任务等级" class="form-control">
                                        <option value="">请选择任务等级</option>
                                        <option value="1">1级</option>
                                        <option value="2">2级</option>
                                        <option value="3">3级</option>
                                        <option value="4">4级</option>
                                    </select>
                                </div>
                            </div>
                        </td>
                    </tr>
                </table>

                <div class="form-item hidden">
                    <div class="item-label">咨询者来源 </div>
                    <div class="controls">
                        <input type="text" class="text input-large form-control" name="source" value="">
                    </div>
                </div>
                <div class="form-item hidden">
                    <div class="item-label">推荐专业 </div>
                    <div class="controls">
                        <input type="text" class="text input-large form-control" name="recommend" value="">
                    </div>
                </div>
                <div class="form-item hidden">
                    <div class="item-label">受访域名 </div>
                    <div class="controls">
                        <input type="text" class="text input-large form-control" name="visitdomain" value="">
                    </div>
                </div>
                <div class="form-item">
                    <div class="item-label">是否及时分配 </div>
                    <div class="controls">
                        <label>
                            <input type="radio" class="i-check" name="setup_now" id="optionsRadios1" value="0" checked>普通
                        </label>
                        <label style="margin-left: 10px;">
                            <input type="radio" name="setup_now" id="optionsRadios1" value="1" class="i-check">立即分配
                        </label>
                    </div>
                </div>
                {% for f in fields  %}
                <div class="form-item">
                    <div class="item-label">{{ f.title }}
                        <span class="check-tips">{{ f.description }}</span>
                        {% if f.allow_null == 0 %}
                        <label class="error" for="field[{{ f.identifier }}]"></label>
                        {% endif %}
                    </div>
                    <div class="controls">
                        {% if f.type == 'text' %}
                        <input type="text" class="text input-large form-control" name="field[{{ f.identifier }}]"
                               value="" data-rules="{{ f.allow_null == 0?'required':'' }}">
                        {% elseif f.type == 'radio' %}
                        <label class="radio-inline"><input type="radio" name="field[{{ f.identifier }}]" value="1">是</label>
                        <label class="radio-inline"><input type="radio" name="field[{{ f.identifier }}]" value="0">否</label>
                        {% elseif f.type == 'select' %}
                        <select class="form-control" name="field[{{ f.identifier }}]">
                            {% for op in f.rules.choice  %}
                            <option value="{{ op.value }}">{{ op.text }}</option>
                            {% endfor %}
                        </select>
                        {% endif %}
                    </div>
                </div>
                {% endfor %}
            </div>

            <div class="form-item with-padding" style="margin-top: 10px;">
                <input type="hidden" name="id" value="">
                <button class="btn btn-primary" id="submit" type="submit" target-form="form-horizontal">确 定</button>
                <button type="button" class="btn btn-info" onclick="util.close()">关闭</button>
            </div>
        </form>
        <div style="height: 20px;"></div>
    </div>
{% endblock %}
{% block script %}
<link href="{{ __URL__ }}/static/assets/icheck/skins/square/_all.css" rel="stylesheet">
<script type="text/javascript" src="{{ __URL__ }}/static/assets/icheck/icheck.min.js"></script>
<script type="text/javascript">
    $(function(){
        $('.i-check').iCheck({
            checkboxClass: 'icheckbox_square-blue',
            radioClass: 'iradio_square-blue',
            increaseArea: '20%'
        });
    });
</script>
{% endblock %}